﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Post.aspx.cs" Inherits="famails.BackEnd.page.Post" MasterPageFile="~/Master.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <style type="text/css">
        .heartbeat {
            display: none;
            margin: 5px;
            color: blue;
        }
    </style>
    <script language="javascript" type="text/javascript">
        $(function () {
            setInterval(KeepSessionAlive, 10000);
        });

        function KeepSessionAlive() {
            $.post("/FAMail_Back/webapp/page/backend/KeepSessionAlive.ashx", null, function () {
                //$("#result").append("<p>Session is alive and kicking!<p/>");
                setInterval(function () { beatHeart(5); }, 10000);
            });
        }
        function beatHeart(times) {
            var interval = setInterval(function () {
                $(".heartbeat").fadeIn(500, function () {
                    $(".heartbeat").fadeOut(500);
                });
            }, 1000); // beat every second

            // after n times, let's clear the interval (adding 100ms of safe gap)
            setTimeout(function () { clearInterval(interval); }, (2000 * times) + 500);
        }
    </script>
<div style="width:100%;padding:10px;">

    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="border:1px solid #333;padding:0px;margin-bottom:10px;">
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:10px 20px;background:#000;color:#fff;font-size:18px;font-weight:bold;position:relative;">   
            Bài viết
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:10px;">
            <div id="errorbox" runat="server" class="error-box round">
                <asp:Label ID="lblError" runat="server" Text=""></asp:Label>
            </div>
            <div id="successbox" runat="server" class="confirmation-box round">
                <asp:Label ID="lblSuccess" runat="server" Text=""></asp:Label>
            </div>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-12 col-lg-6" style="height: auto;padding:10px;">
                <fieldset>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                    Tiêu đề</label>
                    <asp:Label ID="Label1" runat="server" Visible="False"></asp:Label>
                        <asp:TextBox ID="txtTitle" runat="server" 
                            CssClass="form-control" style="border:1px solid #333;border-radius:0px;" ToolTip="Nhập tựa đề bài viết"></asp:TextBox>
                </fieldset>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-12 col-lg-6" style="height: auto;padding:10px;">
                <fieldset>
                        <label for="simple-input" style="font-weight: bolder; text-transform: none">
                            Đường dẫn</label>
                        <asp:TextBox ID="txtLink" runat="server" 
                            CssClass="form-control" style="border:1px solid #333;border-radius:0px;" ToolTip="Để trống khi không có đường dẫn"></asp:TextBox>
                </fieldset>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-12 col-lg-6" style="height: auto;padding:10px;">
                <fieldset>
                        <label for="simple-input" style="font-weight: bolder; text-transform: none">
                            Nhóm bài viết</label>
                        <asp:DropDownList ID="ddlGroup" runat="server" AppendDataBoundItems="True" 
                            CssClass="form-control" style="border:1px solid #333;border-radius:0px;">
                            <asp:ListItem Value="nullgroup">Chọn nhóm</asp:ListItem>
                        </asp:DropDownList>
                </fieldset>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-12 col-lg-6" style="height: auto;padding:10px;">
                <fieldset>
                        <label for="simple-input" style="font-weight: bolder; text-transform: none">
                            Icon bài viết</label>
                            <asp:FileUpload ID="fUlIcon" runat="server"
                            CssClass="form-control" style="border:1px solid #333;border-radius:0px;" />
                </fieldset>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-12 col-lg-6" style="height: auto;padding:10px;">
                <fieldset>
                        <label for="simple-input" style="font-weight: bolder; text-transform: none">
                            Ẩn / Hiện</label>
                        <asp:DropDownList ID="ddlIsShow" runat="server" CssClass="form-control" style="border:1px solid #333;border-radius:0px;">
                            <asp:ListItem>Chọn 1 mục</asp:ListItem>
                            <asp:ListItem Value="True">Hiển thị</asp:ListItem>
                            <asp:ListItem Value="False">Không hiển thị</asp:ListItem>
                        </asp:DropDownList>
                </fieldset>
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Tóm tắt</label>
                    <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Rows="5" CssClass="form-control" style="border:1px solid #333;border-radius:0px;"></asp:TextBox>
                </p>
            </fieldset>
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Nội dung</label>
                    <asp:TextBox ID="txtContent" CssClass="ckeditor" runat="server" TextMode="MultiLine" style="border:1px solid #333;border-radius:0px;"></asp:TextBox>
                </p>
            </fieldset>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-12 col-lg-6" style="height: auto;padding:10px;">
            <fieldset>
                <p>
                    <label for="simple-input" style="font-weight: bolder; text-transform: none">
                        Tags</label>
                    <asp:TextBox ID="txtTags" runat="server" TextMode="MultiLine" Rows="5" CssClass="form-control" style="border:1px solid #333;border-radius:0px;"></asp:TextBox>
                </p>
            </fieldset>
        </div>
        <div class="col-md-6 col-xs-12 col-sm-12 col-lg-6" style="height: auto;padding:10px;text-align:left;">
            <fieldset>
                <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="margin:20px 0px;background:#fee;color:#f99;border-radius:0px;padding:10px;font-size:14px;border:1px solid #f99;text-align:center">
                    Vui lòng dùng dấu phẩy ( , ) để phân tách 2 tag khác nhau.
                </div>
                <button id="btnSubmit" runat="server" class="btn" style="float:left;margin-right:10px;background:#333;color:#fff;text-align:center;padding:6px 15px;border-radius:0px;" 
                    onserverclick="btnSubmit_Click">
                    <i style="margin-right:10px;" class="fa fa-save"></i> Lưu bài viết
                </button>
                <button id="btncapnhat" runat="server" class="btn" style="float:left;margin-right:10px;background:#333;color:#fff;text-align:center;padding:6px 15px;border-radius:0px;" 
                    onserverclick="btncapnhat_Click">
                    <i style="margin-right:10px;" class="fa fa-save"></i> Cập nhật
                </button>
            </fieldset>
        </div>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding:10px 20px;background:#000;color:#fff;font-size:18px;font-weight:bold;position:relative;">   
            Danh sách bài viết
        </div>

            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="height: auto;padding:10px;">
                <fieldset>
                    <div class=" table-responsive">
                    <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                        <thead>
                            <tr>
                                <th>Tên bài viết</th>
                                <th>Nhóm</th>
                                <th style="width:100px;">Tùy chỉnh</th>
                            </tr>
                        </thead>
                        <tbody>
                    <asp:Repeater ID="dtbaiviet" runat="server">
                         <ItemTemplate>
                            <tr>
                                <td>
                                    <asp:Label ID="lblAttr" runat="server" Text='<%# Eval("keyName") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblGmail" runat="server" Text='<%# Eval("groupName") %>'></asp:Label>
                                </td>
                                <td style="text-align:center;">
                                        <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="../resource/images/edit-validated-icon.png"
                                            CommandArgument='<%# Eval("key") %>' OnClick="btnEdit_Click" />
                                        <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="../resource/images/Delete-icon.png"
                                            CommandArgument='<%# Eval("key") %>'
                                            OnClientClick="return confirmDelete('Bạn có chắc rằng sẽ xóa thuộc tính này không ?')" OnClick="btnDelete_Click" />
                                </td>
                            </tr>     
                         </ItemTemplate>
                     </asp:Repeater>
                        </tbody>
                    </table>
                    </div>
                </fieldset>
            </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        $('#dataTables-example').dataTable();
    });
</script>
</asp:Content>

